#include <algorithm>
#include <cstdio>
#include <cstring>

const int N = 12, M = 1 << N, inf = 0x3f3f3f3f;
int n, m, f[M][N], expand[M], dis[N][N];

int main() {
  scanf("%d%d", &n, &m);
  memset(dis, inf, sizeof(dis));
  for (int i = 1, u, v, w; i <= m; ++i) {
    scanf("%d%d%d", &u, &v, &w);
    --u, --v;
    dis[u][v] = dis[v][u] = std::min(dis[u][v], w);
  }
  memset(f, inf, sizeof(f));
  for (int i = 0; i < n; ++i) {
    f[1 << i][0] = 0;
  }
  for (int i = 1, end = 1 << n; i < end; ++i) {
    expand[i] = i;
    for (int j = 0; j < n; ++j) {
      if ((i >> j) & 1) {
        for (int k = 0; k < n; ++k) {
          if (dis[j][k] != inf)
            expand[i] |= 1 << k;
        }
      }
    }
  }
  for (int i = 3, end = 1 << n; i < end; ++i) {
    for (int sta = i - 1, cost = 0, delta; sta; sta = (sta - 1) & i, cost = 0) {
      if ((expand[sta] & i) == i) {
        delta = i ^ sta;
        for (int j = 0; j < n; ++j) {
          if ((delta >> j) & 1) {
            int tmp = inf;
            for (int k = 0; k < n; ++k)
              if ((sta >> k) & 1)
                tmp = std::min(tmp, dis[k][j]);
            cost += tmp;
          }
        }
        for (int j = 1; j < n; ++j) {
          if (f[sta][j - 1] != inf)
            f[i][j] = std::min(f[i][j], f[sta][j - 1] + cost * j);
        }
      }
    }
  }
  int ans = inf;
  for (int i = 0, U = (1 << n) - 1; i < n; ++i) {
    ans = std::min(ans, f[U][i]);
  }
  printf("%d", ans);
  return 0;
}
